<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>注册</title>
<link rel="stylesheet" type="text/css" href="../css/regist_styles.css">
<script language="JavaScript"
	src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
</head>


<body>

<div class="htmleaf-container">
	<div class="wrapper">
		<div class="container">
			<h1>注册</h1>
			
			<form  class="form" action="merchantRegister" method="post" enctype="multipart/form-data">
				<table>
					<tr><td><input required="required" type="text" placeholder="用户名" name="username" id="username"><div id="userTip"></div></td></tr>
					<tr><td><input required="required" type="password" placeholder="密码" name="password" id="password"></td></tr>
					<tr><td><input required="required" type="text" placeholder="店名" name="shopName"></td></tr>
					<tr><td><input required="required" type="text" placeholder="地址" name="address"></td></tr>
					<tr><td><div  class="div1">
						<div class="div2">上传图片</div>
						<input required="required" type="file" class="inputstyle"  name="icon">
					</div></td></tr>
					<tr><td><button type="submit" id="submitBtn" class="regist-button">注册</button></td></tr>
				</table>
					<a href="merchantLogin.jsp" class="login">登录</a>
			</form>
		</div>

		
		<ul class="bg-bubbles">
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
		</ul>
	</div>
</div>


</body>

<script type="text/javascript">
	$("#username").keyup(function() {
		//      alert("hi");
		var uname = $("input[name=username]").val();
		var json = {
			"account" : uname
		}

		$.ajax("merchantIsRegist", {
			method : "GET",
			type : "json",
			data : json,
			success : function(d) {
				console.log(d);
				var name = document.getElementById("username");
				var div = document.getElementById("userTip");
				if (d == "y") {
					div.innerHTML = "用户名已存在";
				} else {
					div.innerHTML = "";
				}
			}
		});
	});
</script>


</html>